fix: debounce search inputs and expand dive search to all related fields#55
Merged
Conversation
Add DebouncedSearchResults widget that debounces queries (300ms) and shows cached results during loading instead of a full-screen spinner. Applied to all 7 search screens: sites, buddies, equipment, dive centers, dives, buddy picker, and species picker. Expand dive search to match across site name/country/region, dive center name, linked buddy names, tags, custom fields, notes, buddy, and dive master using a single SQL query with LEFT JOINs. Closes #53
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses search UX “spinner churn” by introducing a debounced, cached-results search widget and applying it across multiple search experiences. It also expands dive log search to match across more related data (sites/centers/buddies/tags/custom fields) using a single SQL query with LEFT JOINs.
Changes:
- Added
DebouncedSearchResultswidget to debounce queries (300ms) and keep last successful results visible during loading. - Updated multiple search delegates/screens to use the new debounced/cached-results behavior.
- Expanded
searchDivesSQL to search across dive-related tables/fields via a consolidated JOIN-based query.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/shared/widgets/debounced_search_results.dart | New reusable widget implementing debounce + cached-results loading UI for Riverpod-backed searches. |
| lib/features/marine_life/presentation/widgets/species_picker_dialog.dart | Adds local debounced query state and cached-results loading UI in the species picker dialog. |
| lib/features/equipment/presentation/widgets/equipment_list_content.dart | Switches equipment search delegate to DebouncedSearchResults. |
| lib/features/dive_sites/presentation/widgets/site_list_content.dart | Switches site search delegate to DebouncedSearchResults. |
| lib/features/dive_log/presentation/pages/dive_list_page.dart | Switches dive search delegate to DebouncedSearchResults. |
| lib/features/dive_log/data/repositories/dive_repository_impl.dart | Expands dive search query to match across related tables/fields using JOINs. |
| lib/features/dive_centers/presentation/widgets/dive_center_list_content.dart | Switches dive center search delegate to DebouncedSearchResults. |
| lib/features/buddies/presentation/widgets/buddy_picker.dart | Adds local debounced query state and cached-results loading UI in the buddy picker sheet. |
| lib/features/buddies/presentation/widgets/buddy_list_content.dart | Switches buddy search delegate to DebouncedSearchResults. |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
…eanup, tests Clear debounced query immediately on empty input instead of waiting for the timer, add emptyQueryBuilder for screens that show a prompt on empty queries, simplify the diver filter clause to avoid an unnecessary subquery, and add widget tests for DebouncedSearchResults and repository tests for the expanded dive search joins.
Cover the debounce search logic, cached results during loading, clear-button reset, category filtering, and selection management in both widgets to bring codecov/patch coverage above the 80% target. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add DebouncedSearchResults widget that debounces queries (300ms) and shows cached results during loading instead of a full-screen spinner. Applied to all 7 search screens: sites, buddies, equipment, dive centers, dives, buddy picker, and species picker.
Expand dive search to match across site name/country/region, dive center name, linked buddy names, tags, custom fields, notes, buddy, and dive master using a single SQL query with LEFT JOINs.
Closes #53
Test Plan
flutter testpassesflutter analyzepasses